import java.util.Scanner;

/**
 * Created by Salted fish
 * Description:
 * User: 24539
 * Date：2021-07-30
 * Time: 14:13
 */
public class Test8 {
    public static void main(String[] args) {
        Scanner sn = new Scanner(System.in);
        int n = sn.nextInt();
        System.out.println(fun(n));
    }
    public static int fun(int n){
        int i = 0 ;
        if(n<9){
            return n ;
        }else{
            i = n%10 + fun(n/10);
        }
        return i ;
    }
}
